package com.itany.corejava.day17;


import java.io.Serializable;

@MyAnnotation(value = "aaa",count = 123,arr = {"aaa","bbb","ccc"})
public class Person implements Cloneable, Serializable {

    public static int count;

//    @MyAnnotation("aaa")
    private String id;
    private String name;
    private int age;
    private boolean sex;

    public Person() throws NullPointerException,ArrayIndexOutOfBoundsException {
        System.out.println("Person.Person()");
        count++;
    }

    public Person(String name, int age, boolean sex) {
        System.out.println("Person.Person(String,int,boolean)");
        System.out.println("name = " + name + ", age = " + age + ", sex = " + sex);
        this.name = name;
        this.age = age;
        this.sex = sex;
        count++;
    }

    public Person(String name, int age) {
        System.out.println("Person.Person(String,int)");
        System.out.println("name = " + name + ", age = " + age);
        this.name = name;
        this.age = age;
        count++;
    }

    public static int getCount() {
        return count;
    }

    public static void setCount(int count) {
        Person.count = count;
    }

    public String getId() throws NullPointerException,ArrayIndexOutOfBoundsException{
        return id;
    }

    @MyAnnotation("aaa")
    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    @Deprecated
    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    public void f(String... s){

    }

    public void sleep(){
        System.out.println(name+"正在睡觉");
    }

    public void eat(String food){
        System.out.println(name+"正在吃"+food);
    }

    public void eat(){
        System.out.println(name+"正在吃饭");
    }














}
